package one.to.many.bidir.un.un;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.TableGenerator;

//@Entity
public class E2 implements Serializable {

	private static final long serialVersionUID = -958201904690041335L;

	@Id
	@GeneratedValue(strategy = GenerationType.TABLE, generator = "idgen")
	@TableGenerator(name = "idgen", allocationSize = 1)
	@Column(unique = true, nullable = false)
	private int e21;

	private String e22;
	
	@ManyToOne(optional = false)
	@JoinColumn(name = "id_e1")
	private E1 e1;
	
	public E2(String e22) {
		this.e22 = e22;
	}
	
	public E2(String e22, E1 e1) {
		this.e22 = e22;
		this.e1 = e1;
	}

	public int getE21() {
		return e21;
	}

	public void setE21(int e21) {
		this.e21 = e21;
	}

	public String getE22() {
		return e22;
	}

	public void setE22(String e22) {
		this.e22 = e22;
	}

	public E1 getE1() {
		return e1;
	}

	public void setE1(E1 e1) {
		this.e1 = e1;
	}
}
